package com.example.wangzh.mytest;


import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;

import com.example.wangzh.mytest.base.BaseActivity;
import com.example.wangzh.mytest.databinding.ActivityMainBinding;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wangzh on 2017/10/25.
 */

public class MainActivity extends BaseActivity<ActivityMainBinding> {

    List<String> strs = new ArrayList<>();

    @Override
    protected void initView() {
        setSupportActionBar(mBinding.toolBar);
        strs.add("自定义控件属性");
        strs.add("View事件分发测试");
        strs.add("View布局变换");
        strs.add("OnMeasure");
        strs.add("View尺寸变换");
        strs.add("滚动TextView");
        strs.add("ScaleType测试");
        strs.add("Style测试");
        mBinding.grv.setAdapter(new ArrayAdapter<String>(this, R.layout.grid_item_text, strs));
        mBinding.grv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent;
                switch (strs.get(position)) {
                    case "自定义控件属性":
                        intent = new Intent(MainActivity.this, AttrActivity.class);
                        startActivity(intent);
                        break;
                    case "View事件分发测试":
                        intent = new Intent(MainActivity.this, DispatchEventTestActivity.class);
                        startActivity(intent);
                        break;
                    case "View布局变换":
                        intent = new Intent(MainActivity.this, LayoutTestActivity.class);
                        startActivity(intent);
                        break;
                    case "OnMeasure":
                        intent = new Intent(MainActivity.this, MeasureActivity.class);
                        startActivity(intent);
                        break;
                    case "View尺寸变换":
                        intent = new Intent(MainActivity.this, MeasureTestActivity.class);
                        startActivity(intent);
                        break;
                    case "ScaleType测试":
                        intent = new Intent(MainActivity.this, ScaleTypeActivity.class);
                        startActivity(intent);
                        break;
                    case "滚动TextView":
                        intent = new Intent(MainActivity.this, ScrollTextActivity.class);
                        startActivity(intent);
                        break;
                    case "Style测试":
                        intent = new Intent(MainActivity.this, StyleTestActivity.class);
                        startActivity(intent);
                    default:
                        break;
                }
            }
        });
    }

}